package com.benshou.bsoa.service.dingding;

import com.benshou.bsoa.dto.renshi.req.EmployeeDataRequest;
import com.benshou.bsoa.dto.renshi.res.EmployeeDataResponse;
import com.benshou.bsoa.sao.EmployeeDataClientSao;
import com.benshou.bsoa.utils.CreateAccessTokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class EmployeeDataService {

    @Autowired
    private EmployeeDataClientSao employeeDataClient;

    @Autowired
    private CreateAccessTokenUtil createAccessTokenUtil;

    @Value("${benshou.xinchou.infoList}")
    private String infoList;


    /**
     *  查询员工信息
     * @param employeeDataRequest 请求参数
     * @return 响应对象，包含员工信息
     */
    public EmployeeDataResponse fetchEmployeeData(EmployeeDataRequest employeeDataRequest) throws Exception {
        employeeDataRequest.setApiCode(infoList);
        //System.out.println("infoList: " +  employeeDataClient.getEmployeeData(employeeDataRequest, createAccessTokenUtil.getToken()));
        return employeeDataClient.getEmployeeData(employeeDataRequest, createAccessTokenUtil.getToken());
    }
}